package com.api.shopapi.mapper;

import com.api.shopapi.entity.EInspectRecord;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface EInspectRecordMapper {

    @Insert("insert into e_inspect_record (EInspectRecordCode,UserCode,ElderlyCode,ElderlyName,DoctorName,OrganizationName,InspectItem,Details," +
            "InspectTime,CreateTime,StaffCode,GovernmentCode) values " +
            "(#{eInspectRecord.EInspectRecordCode},#{eInspectRecord.UserCode},#{eInspectRecord.ElderlyCode},#{eInspectRecord.ElderlyName}," +
            "#{eInspectRecord.DoctorName},#{eInspectRecord.OrganizationName},#{eInspectRecord.InspectItem},#{eInspectRecord.Details}," +
            "#{eInspectRecord.InspectTime},#{eInspectRecord.CreateTime},#{eInspectRecord.StaffCode},#{eInspectRecord.GovernmentCode})")
    int insert(@Param("eInspectRecord") EInspectRecord eInspectRecord);

    

    @Select("select * from e_inspect_record where EInspectRecordCode=#{eInspectRecordCode} limit 1")
    EInspectRecord getByEInspectRecordCode(@Param("eInspectRecordCode") String eInspectRecordCode);

    @Select("select * from e_inspect_record where ElderlyCode=#{elderlyCode} order by InspectTime desc")
    List<EInspectRecord> getListByElderlyCode(@Param("elderlyCode") String elderlyCode);




}
